page.tsx 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. import { notFound } from "next/navigation";
  2. import secondselfShot from "@/assets/projects/secondself.webp";
  3. import { BentoGrid, type BentoItem } from "@/components/bento/bento-grid";
  4. import { ArtifactsCard } from "@/components/cards/artifacts";
  5. import { EmojiCard } from "@/components/cards/emoji";
  6. import { FinOpsCard } from "@/components/cards/finops";
  7. import { GlobeCard } from "@/components/cards/globe";
  8. import { HeroCard } from "@/components/cards/hero";
  9. import { MiniCard } from "@/components/cards/mini-card";
  10. import { PackBookCard } from "@/components/cards/packbook";
  11. import { PhotoDeck } from "@/components/cards/photo-deck";
  12. import { ProjectCard } from "@/components/cards/project";
  13. import { SkyCard } from "@/components/cards/sky";
  14. import { TechSphere } from "@/components/cards/tech-sphere";
  15. import { WritingCard } from "@/components/cards/writing";
  16. import { projects } from "@/config/site";
  17. import { getHomeData, getLatestPosts } from "@/lib/data";
  18. import { isLocale } from "@/lib/i18n";
  19. import { getMessages } from "@/messages";
  20. // Static, refreshed hourly: Firebase URLs and the latest posts are baked in.
  21. export const revalidate = 3600;
  22. export default async function Page({
  23. params,
  24. }: {
  25. params: Promise<{ lang: string }>;
  26. }) {
  27. const { lang } = await params;
  28. if (!isLocale(lang)) notFound();
  29. const t = getMessages(lang);
  30. const [home, posts] = await Promise.all([
  31. getHomeData(),
  32. getLatestPosts(lang),
  33. ]);
  34. // A project's name and link from the config, its words in this language.
  35. const project = (id: keyof typeof projects) => ({
  36. ...projects[id],
  37. ...t.projects[id],
  38. });
  39. // Order matters: cards pack first-fit in this order. Sizes are columns × rows
  40. // on phones (2 columns, below the hero's header row), wide phones (2), small
  41. // tablets (2), tablets (3), and desktops (4).
  42. // On tablets:
  43. // [hero ][sky ]
  44. // [hero ][globe]
  45. // [finops ]
  46. // [artifacts ]
  47. // [secondself][pack ]
  48. // [photos ][pack ]
  49. // [photos ][web ]
  50. // [chatbot ][web ]
  51. // [tech][mini][emoji]
  52. // [paper][writing ]
  53. // On desktop:
  54. // [hero ][finops ]
  55. // [hero ][artifacts ]
  56. // [sky][globe][secondself]
  57. // [pack][photos ][web]
  58. // [pack][photos ][web]
  59. // [chatbot ][tech][mini]
  60. // [emoji][paper][writing ]
  61. const items: BentoItem[] = [
  62. {
  63. id: "hero",
  64. tags: ["about"],
  65. label: t.cards.hero,
  66. size: [
  67. [2, 1],
  68. [2, 2],
  69. [2, 2],
  70. [2, 2],
  71. [2, 2],
  72. ],
  73. still: true,
  74. // Below 768px a full-width header row as tall as its content (the first
  75. // three sizes go unused).
  76. header: true,
  77. content: (
  78. <HeroCard avatarUrl={home.avatarUrl} dogUrl={home.dogUrl} lang={lang} />
  79. ),
  80. },
  81. {
  82. id: "finops",
  83. tags: ["work"],
  84. label: "AWS FinOps Agent",
  85. size: [
  86. [2, 2],
  87. [2, 2],
  88. [2, 1],
  89. [3, 1],
  90. [2, 1],
  91. ],
  92. content: <FinOpsCard />,
  93. },
  94. {
  95. id: "artifacts",
  96. tags: ["work"],
  97. label: "Amazon Q artifacts",
  98. size: [
  99. [2, 2],
  100. [2, 2],
  101. [2, 1],
  102. [3, 1],
  103. [2, 1],
  104. ],
  105. content: <ArtifactsCard />,
  106. },
  107. {
  108. id: "sky",
  109. tags: ["about"],
  110. label: t.cards.sky,
  111. size: [
  112. [1, 1],
  113. [1, 1],
  114. [1, 1],
  115. [1, 1],
  116. [1, 1],
  117. ],
  118. content: <SkyCard />,
  119. },
  120. {
  121. id: "globe",
  122. tags: ["about"],
  123. label: t.cards.globe,
  124. size: [
  125. [1, 1],
  126. [1, 1],
  127. [1, 1],
  128. [1, 1],
  129. [1, 1],
  130. ],
  131. content: <GlobeCard />,
  132. },
  133. {
  134. id: "secondself",
  135. tags: ["work"],
  136. label: projects.secondself.name,
  137. size: [
  138. [2, 1],
  139. [2, 1],
  140. [2, 1],
  141. [2, 1],
  142. [2, 1],
  143. ],
  144. content: (
  145. <ProjectCard
  146. image={secondselfShot}
  147. look="secondself"
  148. lang={lang}
  149. project={project("secondself")}
  150. />
  151. ),
  152. },
  153. {
  154. id: "packbook",
  155. tags: ["work"],
  156. label: "PackBook",
  157. size: [
  158. [2, 2],
  159. [2, 2],
  160. [1, 2],
  161. [1, 2],
  162. [1, 2],
  163. ],
  164. content: <PackBookCard />,
  165. },
  166. {
  167. id: "photos",
  168. tags: ["about"],
  169. label: t.cards.photos,
  170. size: [
  171. [2, 2],
  172. [2, 2],
  173. [2, 2],
  174. [2, 2],
  175. [2, 2],
  176. ],
  177. content: <PhotoDeck photos={home.photos} />,
  178. },
  179. {
  180. id: "webagent",
  181. tags: ["work"],
  182. label: projects.webagent.name,
  183. size: [
  184. [1, 2],
  185. [1, 2],
  186. [1, 2],
  187. [1, 2],
  188. [1, 2],
  189. ],
  190. content: (
  191. <ProjectCard
  192. height={800}
  193. image={home.webagentUrl}
  194. look="webagent"
  195. lang={lang}
  196. project={project("webagent")}
  197. width={1000}
  198. />
  199. ),
  200. },
  201. {
  202. id: "chatbot",
  203. tags: ["work"],
  204. label: projects.chatbot.name,
  205. size: [
  206. [2, 1],
  207. [2, 1],
  208. [2, 1],
  209. [2, 1],
  210. [2, 1],
  211. ],
  212. content: (
  213. <ProjectCard
  214. height={1280}
  215. image={home.chatbotUrl}
  216. look="chatbot"
  217. lang={lang}
  218. project={project("chatbot")}
  219. width={2629}
  220. />
  221. ),
  222. },
  223. {
  224. id: "tech",
  225. tags: ["about", "work"],
  226. label: t.cards.tech,
  227. size: [
  228. [1, 1],
  229. [1, 1],
  230. [1, 1],
  231. [1, 1],
  232. [1, 1],
  233. ],
  234. content: <TechSphere />,
  235. },
  236. {
  237. id: "mini",
  238. tags: ["about"],
  239. label: t.cards.mini,
  240. size: [
  241. [1, 1],
  242. [1, 1],
  243. [1, 1],
  244. [1, 1],
  245. [1, 1],
  246. ],
  247. content: <MiniCard />,
  248. },
  249. {
  250. id: "emoji",
  251. tags: ["work"],
  252. label: t.cards.emoji,
  253. size: [
  254. [1, 1],
  255. [1, 1],
  256. [1, 1],
  257. [1, 1],
  258. [1, 1],
  259. ],
  260. content: <EmojiCard />,
  261. },
  262. {
  263. id: "paper",
  264. tags: ["work"],
  265. label: projects.paper.name,
  266. size: [
  267. [1, 1],
  268. [1, 1],
  269. [1, 1],
  270. [1, 1],
  271. [1, 1],
  272. ],
  273. content: (
  274. <ProjectCard
  275. height={1280}
  276. image={home.paperUrl}
  277. look="paper"
  278. lang={lang}
  279. project={project("paper")}
  280. width={1577}
  281. />
  282. ),
  283. },
  284. {
  285. id: "writing",
  286. tags: ["about"],
  287. label: t.cards.writing,
  288. size: [
  289. [2, 2],
  290. [2, 2],
  291. [2, 1],
  292. [2, 1],
  293. [2, 1],
  294. ],
  295. content: <WritingCard lang={lang} posts={posts} />,
  296. },
  297. ];
  298. return <BentoGrid items={items} />;
  299. }